Skip to content

Add interrupt feature #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

marqdevx
Copy link
Member

I've added the minimun configuration to enable the interrupt pin

@github-actions
Copy link

Memory usage change @ 95cbcc6

Board flash % RAM for global variables %
arduino:avr:leonardo 💚 -76 - -22 -0.27 - -0.08 0 - 0 0.0 - 0.0
arduino:avr:mega 💚 -76 - -22 -0.03 - -0.01 0 - 0 0.0 - 0.0
arduino:avr:nano 💚 -76 - -22 -0.25 - -0.07 0 - 0 0.0 - 0.0
arduino:mbed_nano:nano33ble 💚 -128 - -64 -0.01 - -0.01 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 💚 -112 - -48 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m4 💚 -128 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 💚 -128 - -64 -0.02 - -0.01 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 💚 -120 - -48 -0.02 - -0.01 N/A N/A
arduino:samd:mkrzero 💚 -108 - -48 -0.04 - -0.02 0 - 0 0.0 - 0.0
Click for full report table
Board examples/ColorSensor
flash
% examples/ColorSensor
RAM for global variables
% examples/FullExample
flash
% examples/FullExample
RAM for global variables
% examples/GestureSensor
flash
% examples/GestureSensor
RAM for global variables
% examples/InterruptLight
flash
% examples/InterruptLight
RAM for global variables
% examples/InterruptProximity
flash
% examples/InterruptProximity
RAM for global variables
% examples/ProximitySensor
flash
% examples/ProximitySensor
RAM for global variables
%
arduino:avr:leonardo -22 -0.08 0 0.0 -76 -0.27 0 0.0 -22 -0.08 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -72 -0.25 0 0.0
arduino:avr:mega -22 -0.01 0 0.0 -76 -0.03 0 0.0 -22 -0.01 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -66 -0.03 0 0.0
arduino:avr:nano -22 -0.07 0 0.0 -76 -0.25 0 0.0 -22 -0.07 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -70 -0.23 0 0.0
arduino:mbed_nano:nano33ble -64 -0.01 0 0.0 -128 -0.01 0 0.0 -64 -0.01 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -64 -0.01 0 0.0
arduino:mbed_nano:nanorp2040connect -48 -0.0 0 0.0 -112 -0.0 0 0.0 -48 -0.0 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -104 -0.0 0 0.0
arduino:mbed_portenta:envie_m4 -64 -0.01 0 0.0 -128 -0.01 0 0.0 0 0.0 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -128 -0.01 0 0.0
arduino:mbed_portenta:envie_m7 -64 -0.01 0 0.0 -128 -0.02 0 0.0 -64 -0.01 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -128 -0.02 0 0.0
arduino:sam:arduino_due_x_dbg -48 -0.01 N/A N/A -120 -0.02 N/A N/A -48 -0.01 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A -112 -0.02 N/A N/A
arduino:samd:mkrzero -48 -0.02 0 0.0 -108 -0.04 0 0.0 -48 -0.02 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -108 -0.04 0 0.0
Click for full report CSV
Board,examples/ColorSensor<br>flash,%,examples/ColorSensor<br>RAM for global variables,%,examples/FullExample<br>flash,%,examples/FullExample<br>RAM for global variables,%,examples/GestureSensor<br>flash,%,examples/GestureSensor<br>RAM for global variables,%,examples/InterruptLight<br>flash,%,examples/InterruptLight<br>RAM for global variables,%,examples/InterruptProximity<br>flash,%,examples/InterruptProximity<br>RAM for global variables,%,examples/ProximitySensor<br>flash,%,examples/ProximitySensor<br>RAM for global variables,%
arduino:avr:leonardo,-22,-0.08,0,0.0,-76,-0.27,0,0.0,-22,-0.08,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-72,-0.25,0,0.0
arduino:avr:mega,-22,-0.01,0,0.0,-76,-0.03,0,0.0,-22,-0.01,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-66,-0.03,0,0.0
arduino:avr:nano,-22,-0.07,0,0.0,-76,-0.25,0,0.0,-22,-0.07,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-70,-0.23,0,0.0
arduino:mbed_nano:nano33ble,-64,-0.01,0,0.0,-128,-0.01,0,0.0,-64,-0.01,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-64,-0.01,0,0.0
arduino:mbed_nano:nanorp2040connect,-48,-0.0,0,0.0,-112,-0.0,0,0.0,-48,-0.0,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-104,-0.0,0,0.0
arduino:mbed_portenta:envie_m4,-64,-0.01,0,0.0,-128,-0.01,0,0.0,0,0.0,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-128,-0.01,0,0.0
arduino:mbed_portenta:envie_m7,-64,-0.01,0,0.0,-128,-0.02,0,0.0,-64,-0.01,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-128,-0.02,0,0.0
arduino:sam:arduino_due_x_dbg,-48,-0.01,N/A,N/A,-120,-0.02,N/A,N/A,-48,-0.01,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-112,-0.02,N/A,N/A
arduino:samd:mkrzero,-48,-0.02,0,0.0,-108,-0.04,0,0.0,-48,-0.02,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-108,-0.04,0,0.0

Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can fix the spell check failure by adding the problematic word in all lower case (als) here;
https://github.com/arduino-libraries/Arduino_APDS9960/blob/master/.codespellrc#L4

@github-actions
Copy link

github-actions bot commented Jun 7, 2021

Memory usage change @ bb0a9b4

Board flash % RAM for global variables %
arduino:avr:leonardo 💚 -76 - -22 -0.27 - -0.08 0 - 0 0.0 - 0.0
arduino:avr:mega 💚 -76 - -22 -0.03 - -0.01 0 - 0 0.0 - 0.0
arduino:avr:nano 💚 -76 - -22 -0.25 - -0.07 0 - 0 0.0 - 0.0
arduino:mbed_nano:nano33ble 💚 -128 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 💚 -112 - -48 -0.0 - -0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m4 💚 -128 - -64 -0.01 - -0.01 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 💚 -128 - 0 -0.02 - 0.0 0 - 0 0.0 - 0.0
arduino:sam:arduino_due_x_dbg 💚 -120 - -48 -0.02 - -0.01 N/A N/A
arduino:samd:mkrzero 💚 -108 - -48 -0.04 - -0.02 0 - 0 0.0 - 0.0
Click for full report table
Board examples/ColorSensor
flash
% examples/ColorSensor
RAM for global variables
% examples/FullExample
flash
% examples/FullExample
RAM for global variables
% examples/GestureSensor
flash
% examples/GestureSensor
RAM for global variables
% examples/InterruptLight
flash
% examples/InterruptLight
RAM for global variables
% examples/InterruptProximity
flash
% examples/InterruptProximity
RAM for global variables
% examples/ProximitySensor
flash
% examples/ProximitySensor
RAM for global variables
%
arduino:avr:leonardo -22 -0.08 0 0.0 -76 -0.27 0 0.0 -22 -0.08 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -72 -0.25 0 0.0
arduino:avr:mega -22 -0.01 0 0.0 -76 -0.03 0 0.0 -22 -0.01 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -66 -0.03 0 0.0
arduino:avr:nano -22 -0.07 0 0.0 -76 -0.25 0 0.0 -22 -0.07 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -70 -0.23 0 0.0
arduino:mbed_nano:nano33ble 0 0.0 0 0.0 -128 -0.01 0 0.0 0 0.0 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -128 -0.01 0 0.0
arduino:mbed_nano:nanorp2040connect -48 -0.0 0 0.0 -104 -0.0 0 0.0 -48 -0.0 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -112 -0.0 0 0.0
arduino:mbed_portenta:envie_m4 -64 -0.01 0 0.0 -128 -0.01 0 0.0 -64 -0.01 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -64 -0.01 0 0.0
arduino:mbed_portenta:envie_m7 0 0.0 0 0.0 -128 -0.02 0 0.0 -64 -0.01 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -128 -0.02 0 0.0
arduino:sam:arduino_due_x_dbg -48 -0.01 N/A N/A -120 -0.02 N/A N/A -48 -0.01 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A -112 -0.02 N/A N/A
arduino:samd:mkrzero -48 -0.02 0 0.0 -108 -0.04 0 0.0 -48 -0.02 0 0.0 N/A N/A N/A N/A N/A N/A N/A N/A -108 -0.04 0 0.0
Click for full report CSV
Board,examples/ColorSensor<br>flash,%,examples/ColorSensor<br>RAM for global variables,%,examples/FullExample<br>flash,%,examples/FullExample<br>RAM for global variables,%,examples/GestureSensor<br>flash,%,examples/GestureSensor<br>RAM for global variables,%,examples/InterruptLight<br>flash,%,examples/InterruptLight<br>RAM for global variables,%,examples/InterruptProximity<br>flash,%,examples/InterruptProximity<br>RAM for global variables,%,examples/ProximitySensor<br>flash,%,examples/ProximitySensor<br>RAM for global variables,%
arduino:avr:leonardo,-22,-0.08,0,0.0,-76,-0.27,0,0.0,-22,-0.08,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-72,-0.25,0,0.0
arduino:avr:mega,-22,-0.01,0,0.0,-76,-0.03,0,0.0,-22,-0.01,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-66,-0.03,0,0.0
arduino:avr:nano,-22,-0.07,0,0.0,-76,-0.25,0,0.0,-22,-0.07,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-70,-0.23,0,0.0
arduino:mbed_nano:nano33ble,0,0.0,0,0.0,-128,-0.01,0,0.0,0,0.0,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-128,-0.01,0,0.0
arduino:mbed_nano:nanorp2040connect,-48,-0.0,0,0.0,-104,-0.0,0,0.0,-48,-0.0,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-112,-0.0,0,0.0
arduino:mbed_portenta:envie_m4,-64,-0.01,0,0.0,-128,-0.01,0,0.0,-64,-0.01,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-64,-0.01,0,0.0
arduino:mbed_portenta:envie_m7,0,0.0,0,0.0,-128,-0.02,0,0.0,-64,-0.01,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-128,-0.02,0,0.0
arduino:sam:arduino_due_x_dbg,-48,-0.01,N/A,N/A,-120,-0.02,N/A,N/A,-48,-0.01,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-112,-0.02,N/A,N/A
arduino:samd:mkrzero,-48,-0.02,0,0.0,-108,-0.04,0,0.0,-48,-0.02,0,0.0,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,-108,-0.04,0,0.0

@@ -52,7 +52,7 @@ bool APDS9960::begin() {
if (!setWTIME(0xFF)) return false;
if (!setGPULSE(0x8F)) return false; // 16us, 16 pulses // default is: 0x40 = 8us, 1 pulse
if (!setPPULSE(0x8F)) return false; // 16us, 16 pulses // default is: 0x40 = 8us, 1 pulse
if (!setGestureIntEnable(true)) return false;
//if (!setGestureIntEnable(true)) return false;
Copy link

@Rocketct Rocketct Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not fine, if useless remove the cmment otherwise add and fix incompatibility

Comment on lines +69 to +70
/*clearLightInterrupt();
clearProximityInterrupt();*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@@ -428,15 +433,99 @@ int APDS9960::readProximity() {
return -1;
}

disableProximity();
//disableProximity();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

#if defined(APDS9960_INT_PIN)
APDS9960 APDS(APDS9960_WIRE_INSTANCE, APDS9960_INT_PIN);
#elif defined(ARDUINO_ARDUINO_NANO33BLE)
APDS9960 APDS(Wire1, PIN_INT_APDS);
#else
APDS9960 APDS(Wire, -1);
#endif
#endif

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line here

Comment on lines +485 to +487
data &= 0b01111111; //MSB reserved
data |= 0b1; //PowerON
data |= 0b00010000; //ALS

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no number create macros and give a meanings to each action

void APDS9960::enableProximityInterrupt(){
uint8_t data;
getENABLE(&data);
data &= 0b01111111; //MSB reserved

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no number create macros and give a meanings to each action

Comment on lines +456 to +458
data &= 0b01111111; //MSB reserved
data |= 0b1; //PowerON
data &= 0b01011111; //Int prox disable

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no number create macros and give a meanings to each action

@@ -150,4 +168,4 @@ class APDS9960 {

extern APDS9960 APDS;

#endif // ARDUINO_APDS9960
#endif // ARDUINO_APDS9960

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line here

@aentinger
Copy link
Contributor

@marqdevx please address the feedback provided by @Rocketct so we can move on and merge this one.

@per1234 per1234 added status: changes requested Changes to PR are required before merge topic: code Related to content of the project itself type: enhancement Proposed improvement labels Jan 15, 2022
@per1234 per1234 dismissed their stale review January 15, 2022 06:46

All the changes I requested have been made. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: changes requested Changes to PR are required before merge topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants